home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / AtomicClock / AtomicClock.jar / AtomicClock.class (.txt) next >
Encoding:
Java Class File  |  2002-08-28  |  8.2 KB  |  393 lines

  1. import java.util.Calendar;
  2. import java.util.TimeZone;
  3. import javax.microedition.lcdui.Command;
  4. import javax.microedition.lcdui.CommandListener;
  5. import javax.microedition.lcdui.Display;
  6. import javax.microedition.lcdui.Displayable;
  7. import javax.microedition.lcdui.Form;
  8. import javax.microedition.lcdui.StringItem;
  9. import javax.microedition.lcdui.TextField;
  10. import javax.microedition.midlet.MIDlet;
  11. import javax.microedition.midlet.MIDletStateChangeException;
  12. import javax.microedition.rms.RecordStore;
  13. import javax.microedition.rms.RecordStoreException;
  14.  
  15. public class AtomicClock extends MIDlet implements CommandListener {
  16.    // $FF: renamed from: n javax.microedition.lcdui.Display
  17.    private Display field_0 = Display.getDisplay(this);
  18.    // $FF: renamed from: o javax.microedition.lcdui.Command
  19.    private Command field_1;
  20.    // $FF: renamed from: int javax.microedition.lcdui.Command
  21.    private Command field_2;
  22.    // $FF: renamed from: h javax.microedition.lcdui.Command
  23.    private Command field_3;
  24.    // $FF: renamed from: l javax.microedition.lcdui.Command
  25.    private Command field_4;
  26.    // $FF: renamed from: u javax.microedition.lcdui.Command
  27.    private Command field_5;
  28.    // $FF: renamed from: f javax.microedition.lcdui.Command
  29.    private Command field_6;
  30.    // $FF: renamed from: g javax.microedition.lcdui.Form
  31.    private Form field_7 = new Form("Atomic Clock");
  32.    // $FF: renamed from: b c
  33.    private AtomicClock$c field_8 = new AtomicClock$c(this);
  34.    // $FF: renamed from: do a
  35.    private AtomicClock$a field_9 = new AtomicClock$a(this);
  36.    // $FF: renamed from: try b
  37.    private AtomicClock$b field_10;
  38.    // $FF: renamed from: for javax.microedition.lcdui.StringItem
  39.    private static StringItem field_11;
  40.    // $FF: renamed from: p javax.microedition.lcdui.StringItem
  41.    private static StringItem field_12;
  42.    // $FF: renamed from: i javax.microedition.lcdui.TextField
  43.    private static TextField field_13;
  44.    // $FF: renamed from: q javax.microedition.lcdui.TextField
  45.    private static TextField field_14;
  46.    // $FF: renamed from: long java.lang.String
  47.    private static String field_15;
  48.    // $FF: renamed from: t int
  49.    private static int field_16;
  50.    // $FF: renamed from: m int
  51.    private static int field_17;
  52.    // $FF: renamed from: s int
  53.    private static int field_18;
  54.    // $FF: renamed from: goto java.lang.String
  55.    private static final String field_19 = "GMT Offset";
  56.    // $FF: renamed from: char java.lang.String
  57.    private static final String field_20 = "Daylight Saving";
  58.    // $FF: renamed from: c java.lang.String
  59.    private static final String field_21 = "Connecting";
  60.    // $FF: renamed from: void java.lang.String
  61.    private static final String field_22 = "Downloading";
  62.    // $FF: renamed from: null java.lang.String
  63.    private static final String field_23 = "Failed to connect!";
  64.    // $FF: renamed from: k int
  65.    private static int field_24;
  66.    // $FF: renamed from: if int
  67.    private static int field_25;
  68.    // $FF: renamed from: r java.lang.String
  69.    private static String field_26 = "UTC";
  70.    // $FF: renamed from: e java.util.Calendar
  71.    private static Calendar field_27;
  72.    // $FF: renamed from: a java.util.TimeZone
  73.    private static TimeZone field_28;
  74.    // $FF: renamed from: j java.lang.String
  75.    private String field_29;
  76.    // $FF: renamed from: case int
  77.    private int field_30;
  78.    // $FF: renamed from: d int
  79.    private int field_31 = 0;
  80.    // $FF: renamed from: byte boolean
  81.    private boolean field_32;
  82.    // $FF: renamed from: else java.lang.String
  83.    private String field_33;
  84.    // $FF: renamed from: new javax.microedition.rms.RecordStore
  85.    private RecordStore field_34;
  86.  
  87.    public AtomicClock() {
  88.       this.method_6();
  89.       field_11 = new StringItem("", "GMT Offset");
  90.       field_12 = new StringItem("", "Daylight Saving");
  91.       field_13 = new TextField("", field_24 + "", 3, 2);
  92.       field_14 = new TextField("", field_25 + "", 3, 2);
  93.       this.field_1 = new Command("Exit", 7, 1);
  94.       this.field_2 = new Command("Query", 1, 1);
  95.       this.field_4 = new Command("Options", 1, 1);
  96.       this.field_5 = new Command("Status", 1, 1);
  97.       this.field_6 = new Command("About", 1, 1);
  98.       this.field_3 = new Command("Stop", 1, 1);
  99.       this.field_7.addCommand(this.field_1);
  100.       this.field_7.addCommand(this.field_2);
  101.       this.field_7.addCommand(this.field_4);
  102.       this.field_7.addCommand(this.field_5);
  103.       this.field_7.addCommand(this.field_6);
  104.       this.field_7.setCommandListener(this);
  105.       field_28 = TimeZone.getDefault();
  106.       field_27 = Calendar.getInstance(field_28);
  107.       this.field_29 = field_28.getID();
  108.       this.field_30 = field_28.getRawOffset();
  109.       this.field_32 = field_28.useDaylightTime();
  110.    }
  111.  
  112.    public void startApp() throws MIDletStateChangeException {
  113.       this.field_0.setCurrent(this.field_7);
  114.       this.field_8.start();
  115.       this.field_9.start();
  116.    }
  117.  
  118.    public void pauseApp() {
  119.    }
  120.  
  121.    public void destroyApp(boolean var1) {
  122.       AtomicClock.a.access$000(this.field_9);
  123.       this.field_9 = null;
  124.       AtomicClock.c.access$100(this.field_8);
  125.       this.field_8 = null;
  126.    }
  127.  
  128.    // $FF: renamed from: a (int) java.lang.String
  129.    private static String method_0(int var0) {
  130.       return var0 < 10 ? "0" + var0 : "" + var0;
  131.    }
  132.  
  133.    // $FF: renamed from: try () void
  134.    private void method_1() {
  135.       field_27 = Calendar.getInstance(field_28);
  136.       this.field_33 = method_0(field_27.get(11)) + ":" + method_0(field_27.get(12)) + ":" + method_0(field_27.get(13));
  137.       String var1 = "System Time: " + this.field_33 + "\nTime Zone ID: " + this.field_29 + "\nDefault Offset: " + this.field_30 + "\nChosen Offset: " + this.field_31 + "\nDaylight Saving? " + (this.field_32 ? "yes" : "no");
  138.       this.field_7.append(new StringItem("", var1));
  139.       Object var2 = null;
  140.    }
  141.  
  142.    // $FF: renamed from: for () void
  143.    private void method_2() {
  144.       this.field_7.append(field_11);
  145.       this.field_7.append(field_13);
  146.       this.field_7.append(field_12);
  147.       this.field_7.append(field_14);
  148.       field_11.setText("GMT Offset");
  149.       field_12.setText("Daylight Saving");
  150.       field_13.setString(field_24 + "");
  151.       field_14.setString(field_25 + "");
  152.       field_13.setString(field_24 + "");
  153.       field_14.setString(field_25 + "");
  154.    }
  155.  
  156.    // $FF: renamed from: do () void
  157.    private void method_3() {
  158.       this.field_7.append(new StringItem("", "Atomic Clock v1.0.0\nhttp://www.zeroindex.co.uk\ninfo@zeroindex.co.uk"));
  159.    }
  160.  
  161.    // $FF: renamed from: if () void
  162.    private void method_4() {
  163.       int var1 = this.field_7.size();
  164.  
  165.       for(int var2 = 0; var2 < var1; ++var2) {
  166.          this.field_7.delete(0);
  167.       }
  168.  
  169.    }
  170.  
  171.    // $FF: renamed from: int () void
  172.    private void method_5() {
  173.       try {
  174.          field_24 = Integer.parseInt(field_13.getString());
  175.       } catch (NumberFormatException var3) {
  176.          field_24 = 0;
  177.       }
  178.  
  179.       try {
  180.          field_25 = Integer.parseInt(field_14.getString());
  181.       } catch (NumberFormatException var2) {
  182.          field_25 = 0;
  183.       }
  184.  
  185.       if (field_24 > 12 || field_24 < -12) {
  186.          field_24 = 0;
  187.       }
  188.  
  189.       if (field_25 > 12 || field_25 < -12) {
  190.          field_24 = 0;
  191.       }
  192.  
  193.       if (field_24 == 0 && field_25 == 0) {
  194.          field_26 = "UTC";
  195.       } else {
  196.          field_26 = "Local";
  197.       }
  198.  
  199.       this.field_31 = field_24 + field_25;
  200.    }
  201.  
  202.    public void commandAction(Command var1, Displayable var2) {
  203.       this.method_5();
  204.       this.method_7();
  205.       if (var1 == this.field_2) {
  206.          this.method_4();
  207.          this.field_10 = new AtomicClock$b(this);
  208.          field_11 = new StringItem("", "GMT Offset");
  209.          this.field_7.append(field_11);
  210.          this.field_7.append(this.field_10);
  211.          field_11.setText("Connecting");
  212.          this.field_7.removeCommand(this.field_2);
  213.          this.field_7.removeCommand(this.field_4);
  214.          this.field_7.removeCommand(this.field_5);
  215.          this.field_7.removeCommand(this.field_6);
  216.          this.field_7.removeCommand(this.field_1);
  217.          this.field_7.addCommand(this.field_3);
  218.          this.field_10.if();
  219.          AtomicClock.a.access$200(this.field_9);
  220.       } else if (var1 == this.field_4) {
  221.          this.method_4();
  222.          this.method_2();
  223.       } else if (var1 == this.field_5) {
  224.          this.method_4();
  225.          this.method_1();
  226.       } else if (var1 == this.field_6) {
  227.          this.method_4();
  228.          this.method_3();
  229.       } else if (var1 == this.field_3) {
  230.          field_11.setText("");
  231.          if (AtomicClock.a.access$300(this.field_9)) {
  232.             AtomicClock.a.access$400(this.field_9);
  233.          } else {
  234.             AtomicClock.c.access$500(this.field_8);
  235.          }
  236.  
  237.          this.field_7.removeCommand(this.field_3);
  238.          this.field_7.addCommand(this.field_2);
  239.          this.field_7.addCommand(this.field_4);
  240.          this.field_7.addCommand(this.field_5);
  241.          this.field_7.addCommand(this.field_6);
  242.          this.field_7.setCommandListener(this);
  243.       } else if (var1 == this.field_1) {
  244.          AtomicClock.a.access$000(this.field_9);
  245.          AtomicClock.c.access$100(this.field_8);
  246.          this.destroyApp(false);
  247.          ((MIDlet)this).notifyDestroyed();
  248.       }
  249.  
  250.    }
  251.  
  252.    // $FF: renamed from: new () void
  253.    private void method_6() {
  254.       byte[] var1 = new byte[]{0};
  255.       byte[] var2 = new byte[]{0};
  256.  
  257.       try {
  258.          this.field_34 = RecordStore.openRecordStore("atomic", true);
  259.          int var3 = this.field_34.getNumRecords();
  260.          if (var3 == 0) {
  261.             this.field_34.addRecord(var1, 0, 1);
  262.             this.field_34.addRecord(var2, 0, 1);
  263.          } else {
  264.             var1 = this.field_34.getRecord(1);
  265.             var2 = this.field_34.getRecord(2);
  266.          }
  267.       } catch (RecordStoreException var4) {
  268.          this.method_8("problem with initialising offsets\n" + var4);
  269.       }
  270.  
  271.       field_24 = var1[0];
  272.       field_25 = var2[0];
  273.    }
  274.  
  275.    // $FF: renamed from: a () void
  276.    private void method_7() {
  277.       try {
  278.          this.field_34 = RecordStore.openRecordStore("atomic", true);
  279.          byte[] var1 = new byte[]{(new Integer(field_24)).byteValue()};
  280.          byte[] var2 = new byte[]{(new Integer(field_25)).byteValue()};
  281.          this.field_34.setRecord(1, var1, 0, var1.length);
  282.          this.field_34.setRecord(2, var2, 0, var2.length);
  283.       } catch (RecordStoreException var3) {
  284.          this.method_8("problem with setting offset data\n" + var3);
  285.       }
  286.  
  287.    }
  288.  
  289.    // $FF: renamed from: a (java.lang.String) void
  290.    public void method_8(String var1) {
  291.       System.out.println(var1);
  292.    }
  293.  
  294.    // $FF: synthetic method
  295.    static String access$602(String var0) {
  296.       field_15 = var0;
  297.       return var0;
  298.    }
  299.  
  300.    // $FF: synthetic method
  301.    static int access$700() {
  302.       return field_16;
  303.    }
  304.  
  305.    // $FF: synthetic method
  306.    static String access$800(int var0) {
  307.       return method_0(var0);
  308.    }
  309.  
  310.    // $FF: synthetic method
  311.    static int access$900() {
  312.       return field_17;
  313.    }
  314.  
  315.    // $FF: synthetic method
  316.    static int access$1000() {
  317.       return field_18;
  318.    }
  319.  
  320.    // $FF: synthetic method
  321.    static String access$600() {
  322.       return field_15;
  323.    }
  324.  
  325.    // $FF: synthetic method
  326.    static String access$1100() {
  327.       return field_26;
  328.    }
  329.  
  330.    // $FF: synthetic method
  331.    static StringItem access$1200() {
  332.       return field_11;
  333.    }
  334.  
  335.    // $FF: synthetic method
  336.    static int access$1008() {
  337.       return field_18++;
  338.    }
  339.  
  340.    // $FF: synthetic method
  341.    static int access$908() {
  342.       return field_17++;
  343.    }
  344.  
  345.    // $FF: synthetic method
  346.    static int access$1002(int var0) {
  347.       field_18 = var0;
  348.       return var0;
  349.    }
  350.  
  351.    // $FF: synthetic method
  352.    static int access$708() {
  353.       return field_16++;
  354.    }
  355.  
  356.    // $FF: synthetic method
  357.    static int access$902(int var0) {
  358.       field_17 = var0;
  359.       return var0;
  360.    }
  361.  
  362.    // $FF: synthetic method
  363.    static int access$702(int var0) {
  364.       field_16 = var0;
  365.       return var0;
  366.    }
  367.  
  368.    // $FF: synthetic method
  369.    static int access$1300(AtomicClock var0) {
  370.       return var0.field_31;
  371.    }
  372.  
  373.    // $FF: synthetic method
  374.    static AtomicClock$c access$1400(AtomicClock var0) {
  375.       return var0.field_8;
  376.    }
  377.  
  378.    // $FF: synthetic method
  379.    static Command access$1600(AtomicClock var0) {
  380.       return var0.field_1;
  381.    }
  382.  
  383.    // $FF: synthetic method
  384.    static Form access$1700(AtomicClock var0) {
  385.       return var0.field_7;
  386.    }
  387.  
  388.    // $FF: synthetic method
  389.    static AtomicClock$b access$1800(AtomicClock var0) {
  390.       return var0.field_10;
  391.    }
  392. }
  393.